package me.zhengjie.network;

import me.zhengjie.dao.FreezeDao;
import me.zhengjie.dao.MergeTaskDao;
import me.zhengjie.enums.ConstantStatus;
import me.zhengjie.vo.OutBoundTaskToWcsVo;
import me.zhengjie.vo.Result;

public class WcsNetworkRequest extends BaseNetworkRequest{

    // AGV
    public static Result<?> deliveryTask(OutBoundTaskToWcsVo request) {
        String requestURL = "http://localhost:8080/delivery/task";
        return requestWCS("AGV调用车出入库 ", request, requestURL);
    }

    public static Result<?> mergeOutBoundDeliveryTask(MergeTaskDao mergeTaskDao) {
        OutBoundTaskToWcsVo task = new OutBoundTaskToWcsVo();
        task.setContainerCode(mergeTaskDao.getContainerCode());
        task.setSource(mergeTaskDao.getTaskStart());
        task.setDestination(mergeTaskDao.getTaskEnd());
        task.setPriority(1);
        task.setFloor(mergeTaskDao.getFloor());
        task.setDeliveryType(ConstantStatus.InBound_Delivery_Type);
        task.setTaskType(ConstantStatus.Merge_OutBound_Type);
        // 调用WCS接口
        return deliveryTask(task);
    }

    public static Result<?> freezeDeliveryTask(FreezeDao freeDao) {
        OutBoundTaskToWcsVo task = new OutBoundTaskToWcsVo();
        task.setContainerCode(freeDao.getContainerCode());
        task.setSource(freeDao.getTaskStart());
        task.setDestination(freeDao.getTaskEnd());
        task.setPriority(1);
        task.setFloor(freeDao.getFloor());
        task.setDeliveryType(ConstantStatus.InBound_Delivery_Type);
        task.setTaskType(ConstantStatus.Freeze_OutBound_Type);
        // 调用WCS接口
        return deliveryTask(task);
    }

}
